CXX = g++
TARGET = bench
SRC = $(wildcard *.cpp)
OBJ = $(patsubst %.cpp,%.o,$(SRC))
LIBS = -llogger
INCLUDE = ../include
LIBPATH = ../lib

CXXFLAGS = -std=c++17
LDFLAGS = -L$(LIBPATH) -lpthread $(LIBS)
INCLUDE_FLAGS = -I$(INCLUDE)

$(TARGET): $(OBJ)
	@echo "Linking $@..."
	@$(CXX) $^ -o $@ $(LDFLAGS)

%.o: %.cpp
	@echo "Compiling $<..."
	@$(CXX) -c $< -o $@ $(CXXFLAGS) $(INCLUDE_FLAGS)

.PHONY: clean
clean:
	@echo "Cleaning up..."
	@rm -f *.o $(TARGET)

# 支持并行编译
.DELETE_ON_ERROR:
